<template>
	<view class="examina">
		<view class="title1">
			考试科目
			<text>{{ testData.title }}</text>
		</view>
		<view class="title1">
			题目数量
			<text>{{ testData.number }}题</text>
		</view>
		<view class="title1">
			总分数
			<text class="fraction">{{ testData.score }}分</text>
		</view>
		<view class="title1">
			考试时间
			<text>{{ testData.exam_duration }}分钟</text>
		</view>
		<view class="line"></view>
		<view class="content">
			<view class="content_tit">考试规则</view>
			<view class="content_x"><u-parse :html="testData.exam_rule"></u-parse></view>
			<view class="content_but" @tap="immediatelyTest">立即考试</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			course_id: '',
			testData: '',
			order_sn: ''
		};
	},
	onLoad(option) {
		this.course_id = option.course_id;
		this.order_sn = option.order_sn;
		uni.showLoading({
			title: '加载中'
		});
		this.testInformationInfo();
	},

	methods: {
		testInformationInfo() {
			this.$api
				.post(global.apiUrls.getTestInformation, {
					course_id: this.course_id,
					order_sn: this.order_sn
				})
				.then(res => {
					console.log(res);
					uni.hideLoading();
					if (res.data.code == 1) {
						this.testData = res.data.data;
					} else {
						this.$message.info(res.data.msg);
					}
				});
		},
		// 开始考试
		immediatelyTest() {
			uni.navigateTo({
				url: '/pages/home/home/examination?course_id=' + this.course_id + '&exam_duration=' + this.testData.exam_duration + '&type=' + 1
			});
		}
	}
};
</script>

<style lang="scss" scoped>
page {
	background: #ffffff !important;
	color: #333333;
	font-size: 32rpx;
}

.examina {
	padding: 32rpx 0;
	.title1 {
		padding: 0 32rpx;
		font-size: 32rpx;
		color: #999999;
		margin-bottom: 32rpx;
		text {
			color: #333333;
			margin-left: 40rpx;
		}
		.fraction {
			margin-left: 72rpx;
		}
	}
	.line {
		height: 16rpx;
		width: 100%;
		background: #f5f6f7;
	}
	.content {
		padding: 32rpx;
		.content_tit {
			color: #267dff;
			margin-bottom: 36rpx;
		}
		.content_x {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 400;
			line-height: 42rpx;
			color: #999999;
			margin-bottom: 278rpx;
		}
		.content_but {
			width: 520rpx;
			height: 88rpx;
			background: #267dff;
			opacity: 1;
			border-radius: 44rpx;
			line-height: 88rpx;
			text-align: center;
			color: #ffffff;
			margin: 0 auto;
		}
	}
}
</style>
